home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr44 / lrdchelp.zip / DROPFILE.DOC next >
Text File  |  1995-04-08  |  3KB  |  87 lines

  1. What Do I Do For A Dropfile?
  2.  
  3.         The preferred method is to read INFO.X directly and pass the
  4.         information on comport, speed, etc. to your door library
  5.         directly.  I tried that with Opendoors and was somewhat less
  6.         than fully successful.  So, I went to plan B...
  7.  
  8.         Alternately, if your door library permits, you can define
  9.         INFO.X as a custom drop file type and let your door library
  10.         deal with getting the information it needs by reading the
  11.         file internally.  This is the method used with TRX.  Look
  12.         at the LRDTRX??.CFG files for an example of the format needed
  13.         for use with Opendoors.
  14.  
  15.         If, for some reason, you really, really, REALLY have to have
  16.         a standard dropfile, the next best thing to do is to parse
  17.         it's location out of the NODEX.DAT file.  This is Seth's
  18.         configuration file.  It has lots of useful information in 
  19.         there.  This is the method I'm using in an as yet unreleased
  20.         IGM called Chrono's Tick-Tock Shop (I probably should be
  21.         working on it now, instead of doing this, but, what the 
  22.         heck? <g>).  The function below is what I use in that one.
  23.         It's kinda rough yet, but you should get the general idea.
  24.         If your door library needs the name of the drop file instead
  25.         of just the location, you can spiff this up a bit and get
  26.         that out of NODEX.DAT too.
  27.  
  28. void read_node( char *nodenum )
  29.   {
  30.   char temp[100];
  31.   char temp2[100];
  32.   char temp3[100];
  33.   FILE *f;
  34.  
  35.   strcpy( temp, "NODE" );
  36.   strcat( temp, nodenum );
  37.   strcat( temp, ".DAT");
  38.  
  39.   get_access_hard( temp );
  40.  
  41.   f = fopen( temp, "rt" );
  42.  
  43.   fgets( temp2, 81, f);
  44.  
  45.   do
  46.     {
  47.     if (!strcmp( "BBSDROP", strtok( temp2, " ")))
  48.       {
  49.       strcpy( temp3, strtok( NULL, " "));
  50.       trim( temp3 );
  51.       strcpy( od_control.info_path, temp3 );
  52.       break;
  53.       }
  54.     } while (NULL != fgets( temp2, 81, f));
  55.  
  56.   if (!strcmp( NULL, od_control.info_path))
  57.     {
  58.     printf("BUMMER!  %s must be mangled.  Can't find the BBSDROP parm.\n", 
  59.            temp);
  60.     printf("Notify John Hutton\n");  // Use your own name, please!
  61.     fclose( f );
  62.     unlock_file( temp );
  63.     sleep( 3 );
  64.     exit( 0 );
  65.     }
  66.  
  67.   fclose( f );
  68.   unlock_file( temp );
  69.   }
  70.  
  71. /* This just does the equivalant of an RTRIM - cuts off carriage
  72. ** returns, newlines, and space characters from the end of a string
  73. */
  74.  
  75. void trim( char *string )
  76.   {
  77.   int how_long;
  78.  
  79.   how_long = strlen( string );
  80.   while ((string[how_long - 1] == 13) || (string[how_long - 1] == 10 )
  81.          || (string[how_long - 1] == ' '))
  82.     {
  83.     string[how_long - 1] = '\0';
  84.     how_long = strlen( string );
  85.     }
  86.   }
  87.